RecoverUnsyncedChangesStrategy

interface RecoverUnsyncedChangesStrategy : AutomaticClientResetStrategy

Strategy that attempts to automatically recover any unsynced changes during a Client Reset.

A synced realm may need to be reset because the MongoDB Realm Server encountered an error and had to be restored from a backup or because it has been too long since the client connected to the server so the server has rotated the logs.

The Client Reset thus occurs because the server does not have all the information required to bring the client fully up to date.

The recover unsynced changes process is as follows: when a Client Reset is received by the client the onBeforeReset callback is invoked, after which the client will be reset. Once the reset has concluded the onAfterReset callback will be invoked if the changes have been recovered successfully.

In the event that the client reset could not discard the unsynced data onManualResetFallback will be invoked. This allows to manually resolve the reset as it would have been done by ManuallyRecoverUnsyncedChangesStrategy.onClientReset.

Functions

onAfterReset
Link copied to clipboard
abstract fun onAfterReset(before: TypedRealm, after: MutableRealm)
Callback invoked once the Client Reset happens.
onBeforeReset
Link copied to clipboard
abstract fun onBeforeReset(realm: TypedRealm)
Callback that indicates a Client Reset is about to happen.
onManualResetFallback
Link copied to clipboard
abstract fun onManualResetFallback(session: SyncSession, exception: ClientResetRequiredException)
Callback that indicates the Client reset failed to complete.